home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 14 / 014.d81 / pps #33 < prev    next >
Text File  |  2022-08-26  |  2KB  |  121 lines

  1.  
  2. ======================================
  3.    PEEKs, POKEs, & SYSes -- Part 33
  4.  
  5.        By James Germany Weiler
  6.           and Alien Gardner
  7. ======================================
  8.  
  9.  
  10.   So, now that we know what bits and
  11.  
  12. bytes are, we should be able to
  13.  
  14. understand what a bit map is.  Put
  15.  
  16. simply, a bit map is a range of memory
  17.  
  18. wherein every bit represents the
  19.  
  20. presence or absence of some object.
  21.  
  22. Hmmm... that doesn't sound so simple.
  23.  
  24. I guess we need some examples.
  25.  
  26.   The closest thing to a bit map in
  27.  
  28. real life is an old-fashioned school
  29.  
  30. seating chart.  The teacher makes a
  31.  
  32. grid in which each square represents a
  33.  
  34. student's desk.  If a student is
  35.  
  36. absent, his grid square gets a mark.
  37.  
  38. Here's a class of sixty-four with
  39.  
  40. thirteen people absent:
  41.  
  42.    row
  43.                    Each "*" represents
  44.  76543210          a missing student.
  45.  ........  0
  46.  ........  1
  47.  .****...  2  s
  48.  .**..*..  3  e
  49.  .**.....  4  a
  50.  .**.....  5  t
  51.  .**.....  6
  52.  ........  7
  53.  
  54.  
  55.   Now, those thirteen missing students
  56.  
  57. were not chosen at random.
  58.  
  59. Individually, each dot may represent a
  60.  
  61. missing student, but collectively
  62.  
  63. those missing students are a bit-map
  64.  
  65. of the letter "r".
  66.  
  67.   It is not just chance that we chose
  68.  
  69. to put sixty-four students in the
  70.  
  71. class, either.  This classroom is the
  72.  
  73. analog of one character position on
  74.  
  75. your monitor screen.  That is, each
  76.  
  77. character you see is made up of a
  78.  
  79. pattern of 64 light and dark dots in
  80.  
  81. an eight by eight grid.
  82.  
  83.   Why eight by eight?  Well, the
  84.  
  85. Commodore 64's memory is full of
  86.  
  87. eight-bit bytes, so it's easiest and
  88.  
  89. most efficient to arrange things to
  90.  
  91. fall exactly on byte boundaries.
  92.  
  93. Let's substitute "bit" and "byte" for
  94.  
  95. "row" and "seat" in our seating chart
  96.  
  97. and see what we get...
  98.  
  99.    bit
  100.  
  101.  76543210
  102.  ........  0       0        Each "*"
  103.  ........  1       0        represents
  104.  .****...  2  b  120        a "1" bit.
  105.  .**..*..  3  y  100
  106.  .**.....  4  t   96
  107.  .**.....  5  e   96
  108.  .**.....  6      96
  109.  ........  7       0
  110.  
  111.  
  112.   It appears that the eight bytes
  113.  
  114. needed to make a bit map of the letter
  115.  
  116. "r" are 0, 0, 120, 100, 96, 96, 96,
  117.  
  118. and 0.
  119.  
  120. -------< continued in Part 34 >-------
  121.